package kr.saeildamil.androidstudy.ch11;

import kr.saeildamil.androiddforstudy.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class EditSelect extends Activity {
	EditText mEdit;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch11_editselect);

		mEdit = (EditText) findViewById(R.id.ch11_editselect_edit);
	}

	public void mOnClick(View v) {
		switch (v.getId()) {
		case R.id.ch11_editselect_home:
			mEdit.setSelection(0);
			break;
		case R.id.ch11_editselect_end:
			mEdit.setSelection(mEdit.getText().length());
			break;
		case R.id.ch11_editselect_selblock:
			mEdit.setSelection(3, 10);
			break;
		case R.id.ch11_editselect_selall:
			mEdit.selectAll();
			break;
		case R.id.ch11_editselect_getsel:
			int start = mEdit.getSelectionStart();
			int end = mEdit.getSelectionEnd();
			Toast.makeText(EditSelect.this,
					"Start : " + start + " , End : " + end, Toast.LENGTH_SHORT)
					.show();
		}

	}
}
